using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class online_survey_question_lineMap : EntityTypeConfiguration<online_survey_question_line>
    {
        public online_survey_question_lineMap()
        {
            // Primary Key
            this.HasKey(t => t.online_survey_question_line_id);

            // Properties
            this.Property(t => t.online_survey_answer)
                .IsRequired()
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("online_survey_question_line");
            this.Property(t => t.online_survey_question_line_id).HasColumnName("online_survey_question_line_id");
            this.Property(t => t.online_survey_answer).HasColumnName("online_survey_answer");
            this.Property(t => t.online_survey_score).HasColumnName("online_survey_score");
            this.Property(t => t.status).HasColumnName("status");
            this.Property(t => t.survey_question_sheet_id).HasColumnName("survey_question_sheet_id");
            this.Property(t => t.survey_answer_no).HasColumnName("survey_answer_no");

            // Relationships
            this.HasOptional(t => t.online_survey_question_sheet)
                .WithMany(t => t.online_survey_question_line)
                .HasForeignKey(d => d.survey_question_sheet_id);

        }
    }
}
